package com.ruoyi.api.daoru;

import com.ruoyi.common.constant.HttpStatus;
import lombok.Data;
import org.springframework.expression.spel.ast.Literal;

import java.util.List;

@Data
public class ImportResult {
    private int code;               // 返回码
    private String message;         // 详细信息
    private List<ImportError> data;            // 数据，可以是错误列表或成功消息

    public static ImportResult success(String message) {
        ImportResult result = new ImportResult();
        result.setCode(HttpStatus.SUCCESS);
        result.setMessage(message);
        result.setData(null);
        return result;
    }

    public static ImportResult failureWithErrors(String message, List<ImportError> errors) {
        ImportResult result = new ImportResult();
        result.setCode(HttpStatus.ERROR);
        result.setMessage(message);
        result.setData(errors);
        return result;
    }

    public static ImportResult failure(String message) {
        ImportResult result = new ImportResult();
        result.setCode(HttpStatus.ERROR);
        result.setMessage(message);
        result.setData(null);
        return result;
    }
}
